#pragma once

#include "../base/types.h"

OPEN_JLIB_NS

struct JsonParserProxy {

  virtual ~JsonParserProxy () noexcept = default;

  virtual bool intoDict () noexcept = 0;

  virtual bool exitDict () noexcept = 0;

  virtual bool intoList () noexcept = 0;

  virtual bool exitList () noexcept = 0;

  virtual bool onMore () noexcept = 0;

  virtual bool onPair () noexcept = 0;

  virtual bool onNull () noexcept = 0;

  virtual bool onInteger (long v) noexcept = 0;

  virtual bool onFloat (double v) noexcept = 0;

  virtual bool onBoolean (bool v) noexcept = 0;

  virtual bool onString (const char *s, const char *e) noexcept = 0;

  virtual bool onKey (const char *s, const char *e) noexcept = 0;

  virtual void onError (const char *i) noexcept = 0;
};

	/**
	 * 解析json 返回结束位置或格式错误位置
	 * @param json
	 * @param proxy
	 * @return
	 */
	const char *parse (const char *json, Proxy &proxy) noexcept;


CLOSE_JLIB_NS